import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_module/viewModels/layer_edit_viewmodel.dart';
import 'package:provider/provider.dart';

class StyleRuleFragment extends StatelessWidget {
  const StyleRuleFragment({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    ///路由工具
    final NavigatorState _navi = Navigator.of(context);

    ///viewmodel
    final LayerEditViewModel _model =
        Provider.of<LayerEditViewModel>(context, listen: false);
    return Scaffold(
      appBar: AppBar(
        leading: BackButton(
          onPressed: () {
            _navi.pop();
          },
        ),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Card(
              child: ListTile(
                title: const Text("1"),
                trailing: const Icon(Icons.arrow_forward_ios),
                onTap: () {
                  _model.setStyleRule(1);
                  _navi.pop();
                },
              ),
            ),
            Card(
              child: ListTile(
                title: const Text("2"),
                trailing: const Icon(Icons.arrow_forward_ios),
                onTap: () {
                  _model.setStyleRule(2);
                  _navi.pop();
                },
              ),
            ),
            Card(
              child: ListTile(
                title: const Text("3"),
                trailing: const Icon(Icons.arrow_forward_ios),
                onTap: () {
                  _model.setStyleRule(3);
                  _navi.pop();
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}
